import com.dmotiko.sathya.*

class NewsLoader {

	public static function run(src, target){
		
		var xml:XML = new XML();
		xml.ignoreWhite = true;
		xml.load(src);
				
		xml.onLoad = function(){
			var news:Array = this.firstChild.childNodes;
			var newsData:Array = new Array();
			var oNew:Object;
			for (var i:Number = 0; i < news.length; i++) {
				oNew = new Object();
				oNew.date = news[i].attributes.date;
				oNew.src = news[i].attributes.src;
				oNew.title = news[i].attributes.title;
				oNew.content = news[i].firstChild.toString();
				newsData.push(oNew);
			}
			target.newsData = newsData;
		}
		
	}

}